// SimpleDX11 default VertexShader ConstantBuffer
cbuffer ConstantBuffer
{
        float4x4 World;
        float4x4 View;
        float4x4 Projection;
};

cbuffer Camera
{
    float3 cameraPosition;
    float padding;
};

struct SDXVInput
{
    float4 position  : POSITION;
    float4 normal	 : NORMAL;
    float2 tex 		 : TEXCOORD0;

};
struct SDXVOutput
{
    float4 position		 : SV_POSITION;
    float3 normal		 : NORMAL;
    float2 tex 			 : TEXCOORD0;
    float3 viewDirection : TEXCOORD1;
};

SDXVOutput VShader(SDXVInput Input)
{
    SDXVOutput output;
	float4 wPosition;

    output.position = Input.position;

    output.position = mul(Input.position, World);
    output.position = mul(output.position, View);
    output.position = mul(output.position, Projection);
	output.tex		= Input.tex;
    output.normal	= mul(Input.normal, (float3x3)World);
    output.normal   = normalize(output.normal);
    wPosition = mul(Input.position, World);

    output.viewDirection = normalize(cameraPosition.xyz - wPosition.xyzw);

    return output;
}